package com.xinghou.platform.dao.main.impl;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.xinghou.platform.dao.bases.JdbcTemplate;
import com.xinghou.platform.dao.bases.database.CustomerContextHolder;
import com.xinghou.platform.dao.main.UserAppDAO;
import com.xinghou.platform.model.main.UserApp;

@Service
public class UserAppDAOImpl {/*
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public int updateUserApp(UserApp userapp) throws DataAccessException {
		StringBuffer strSQL = new StringBuffer(
				"UPDATE user_app SET Device_token=?,Ua=?,Regist_ua=?,Version=?,Regist_version=?,Create_time=? WHERE App_id=?");
		Object[] params = { userapp.getDeviceToken(),userapp.getUa(),userapp.getRegistUa(),userapp.getVersion(),
				userapp.getRegistVersion(),userapp.getCreateTime(),userapp.getAppId() };
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
		int ret = jdbcTemplate.update(strSQL.toString(), params);
		CustomerContextHolder.clearCustomerType();
		return ret;
	}

	@Override
	public int saveUserApp(UserApp userapp) throws DataAccessException {
		String sql = "INSERT INTO user_app (App_id,Device_token, Ua,Regist_ua,Version,Regist_version,Create_time,Update_time) VALUES (?,?,?,?,?,?,?,?);";
		Object[] params = {userapp.getAppId(),userapp.getDeviceToken(),userapp.getUa(),userapp.getRegistUa(),userapp.getVersion(),userapp.getRegistVersion(),
				userapp.getCreateTime(),userapp.getUpdateTime() };
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
		int ret = jdbcTemplate.savenukey(sql.toString(),params);
		CustomerContextHolder.clearCustomerType();
		return ret;
	}*/

}
